<include file="public/layout" />
<body style="background-color: #FFF; overflow: auto;">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i class="fa fa-arrow-circle-o-left"></i></a>
            <div class="subject">
                <h3>会员等级管理 - 编辑会员等级</h3>
                <h5>网站系统会员等级管理</h5>
            </div>
        </div>
    </div>
    <form class="form-horizontal" id="handleposition" method="post">
        <input type="hidden" name="act" value="{$act}">
        <input type="hidden" name="level_id" value="{$info.level_id}">
        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit">
                    <label for="level_name"><em>*</em>等级名称</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="level_name" value="{$info.level_name}" id="level_name" class="input-txt">
                    <span class="err" id="err_level_name"></span>
                    <p class="notic">设置会员等级名称</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="amount"><em>*</em>累计业绩</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="amount" value="{$info.amount}" id="amount" class="input-txt" onkeyup="this.value=/^\d+\.?\d{0,2}$/.test(this.value) ? this.value : ''">
                    <span class="err" id="err_amount"></span>
                    <p class="notic">设置会员等级所需要累计业绩数量,单位：台</p>
                </dd>
            </dl>
             <dl class="row">
                <dt class="tit">
                    <label for="amount"><em>*</em>个人任务</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="user_amount" value="{$info.user_amount}" id="user_amount" class="input-txt" onkeyup="this.value=/^\d+\.?\d{0,2}$/.test(this.value) ? this.value : ''">
                    <span class="err" id="err_amount"></span>
                    <p class="notic">设置会员等级所需要的个人任务,单位：台</p>
                </dd>
            </dl>
             <dl class="row">
                <dt class="tit">
                    <label for="amount"><em>*</em>有效业绩</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="yx_amount" value="{$info.yx_amount}" id="yx_amount" class="input-txt" onkeyup="this.value=/^\d+\.?\d{0,2}$/.test(this.value) ? this.value : ''">
                    <span class="err" id="err_amount"></span>
                    <p class="notic">设置会员等级所需要的有效业绩,单位：台</p>
                </dd>
            </dl>


            <dl class="row">
                <dt class="tit">
                    <label for="discount"><em>*</em>分佣比例</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="fenyong" value="{$info.fenyong}" class="input-txt">
                    <span class="err" id="err_discount"></span>
                    <p class="notic">分佣比例率单位为百分比，如输入90，表示90%</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="discount"><em>*</em>分红比例</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="fenhong" value="{$info.fenhong}" class="input-txt">
                    <span class="err" id="err_discount"></span>
                    <p class="notic">分红比例率单位为百分比，如输入90，表示90%</p>
                </dd>
            </dl>


            <dl class="row">
                <dt class="tit">
                    等级描述
                </dt>
                <dd class="opt">
                    <textarea  name="describe" class="tarea" rows="6">{$info.describe}</textarea>
                    <span class="err" id="err_describe"></span>
                    <p class="notic">会员等级描述信息</p>
                </dd>
            </dl>
            <div class="bot"><a href="JavaScript:void(0);" onclick="verifyForm()" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a></div>
        </div>
    </form>
</div>
<script type="text/javascript">
    function verifyForm(){
        $('span.err').show();
        $.ajax({
            type: "POST",
            url: "{:U('Admin/User/levelHandle')}",
            data: $('#handleposition').serialize(),
            dataType: "json",
            error: function () {
                layer.alert("服务器繁忙, 请联系管理员!");
            },
            success: function (data) {
                if (data.status == 1) {
                    layer.msg(data.msg, {icon: 1});
                    location.href = "{:U('Admin/User/levelList')}";
                } else {
                    layer.msg(data.msg, {icon: 2});
                    $.each(data.result, function (index, item) {
                        $('#err_' + index).text(item).show();
                    });
                }
            }
        });
    }
</script>
</body>
</html>